@import '../../style/mixin.less';

@token-selector-px: 20px;

.token-selector {
  padding-bottom: 0;
  .ant-drawer-content-wrapper {
    border-radius: 16px 16px 0px 0px;
    overflow: hidden;
    .ant-drawer-body {
      padding: 18px 0 0;
      display: flex;
      flex-direction: column;
    }
  }
  .ant-drawer-close .anticon.anticon-close > svg {
    color: var(--r-neutral-foot, #6a7587);
  }
  .header {
    font-weight: 500;
    font-size: 20px;
    line-height: 23px;
    text-align: center;
    color: var(--r-neutral-title-1, rgba(25, 41, 69, 1));
    margin-bottom: 20px;
  }
  .input-wrapper {
    width: 100%;
    padding: 0 20px;
    margin: 0 auto 12px;
    .ant-input-affix-wrapper-lg {
      padding: 9.25px;
      border-radius: 8px;
      border: 1px solid var(--r-neutral-line, #d3d8e0);
      background: var(--r-neutral-card1, #fff) !important;
      transition: border-color 0.3s;
      .ant-input {
        &::placeholder {
          color: var(--r-neutral-foot, #6a7587) !important;
        }
      }
      &:hover,
      &.active {
        border-color: var(--r-blue-default, #7084ff);
      }
    }
  }
  .token-sort {
    display: flex;
    margin-bottom: 8px;
    padding: 0 @token-selector-px;
    justify-content: flex-end;
    align-items: center;
    color: var(--r-neutral-foot, #6a7587);
    font-size: 12px;
    line-height: 14px;
    span {
      transition: color 0.3s;
      cursor: pointer;
      &:nth-child(1) {
        margin-right: 4px;
      }
      &:nth-last-child(1) {
        margin-left: 4px;
      }
      &.active {
        color: var(--r-blue-default, #7084ff);
      }
    }
  }
  .token-list {
    position: relative;
    background-color: transparent;
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding-bottom: 20px;
    &::-webkit-scrollbar {
      display: none !important;
    }

    li {
      display: flex;
      flex-direction: column;
      cursor: pointer;
      padding: 0 16px;
      &.swap-to > div,
      & > .token-info > div {
        @token-icon-margin: 6px;
        @symbol-click-pl: 4px;
        &:nth-child(1) {
          width: 160px;
          display: flex;
          align-items: center;
          .token-with-chain + div {
            max-width: calc(100% - 24px);
          }

          .symbol {
            // flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 12px;
            line-height: 15px;
            color: var(--r-neutral-body, #3e495e);
            margin-left: calc(@token-icon-margin + @symbol-click-pl);
            max-width: 100%;
          }
        }
        &:nth-child(2) {
          width: 70px;
          text-align: left;
          font-size: 12px;
          line-height: 14px;
          color: var(--r-neutral-body, #3e495e);
        }
        &:nth-child(3) {
          // width: 100px;
          text-align: right;
          font-size: 13px;
          line-height: 15px;
          color: var(--r-neutral-title-1, rgba(25, 41, 69, 1));
          font-weight: 500;
          flex: 1;
        }

        .symbol_click,
        .token_usd_value {
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          font-size: 15px;
          font-style: normal;
          font-weight: 510;
          line-height: normal;
          color: var(--r-neutral-title-1, rgba(25, 41, 69, 1));
          margin-left: @token-icon-margin;
          max-width: 100%;
          padding: 2px @symbol-click-pl;
          border-radius: 4px;
          width: min-content;
        }

        .token_usd_value {
          margin-left: 0px;
          padding-right: 0px;
        }
        .symbol_click:hover {
          background: var(--r-blue-light2, #dee3fc);
          color: var(--r-blue-default, #7084ff);
        }
      }
    }
    li.token-list__header {
      display: flex;
      flex-direction: row;
      position: sticky;
      top: 0;
      z-index: 1;
      background-color: var(--r-neutral-bg-2, #f7f8fa);
      cursor: initial;
      font-size: 12px;
      line-height: 14px;
      color: var(--r-neutral-foot, #6a7587);
      align-items: center;
      padding: 0 36px;
      padding-bottom: 8px;
      &::after {
        .part-border(360px);
        background-color: transparent;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
      }
      & > div {
        font-size: 12px;
        line-height: 14px;
        color: var(--r-neutral-foot, #6a7587);
        font-weight: normal;
        &:nth-last-child(1) {
          flex: 1;
          text-align: right;
        }
      }
    }
    .token-list__item {
      border: 1px solid transparent;
      box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.04);
      background: var(--r-neutral-card1, #fff);
      border-radius: 8px;
      margin: 0 20px;
      margin-bottom: 8px;
      .token-info {
        height: 60px;
        width: 100%;
        display: flex;
        align-items: center;
      }
      &.token-disabled {
        opacity: 0.5;
        cursor: default;
      }
      &:not(.token-disabled):hover {
        border: 1px solid var(--r-blue-default, #7084ff);
        background: var(--r-blue-light1, #eef1ff);

        .symbol_click {
          color: var(--r-blue-default, #7084ff);
        }
      }
    }
    &.empty {
      height: 400px;
      .no-token {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        .icon-loading {
          width: 36px;
          height: 36px;
          animation: spining 1s linear infinite;
        }
        .no-data-image {
          width: 100px;
          height: 100px;
        }
      }
    }
  }

  .filters-wrapper {
    padding: 0 @token-selector-px;
    margin-bottom: 12px;

    .filter-item__chain {
      cursor: default;
      display: inline-flex;
      padding: 6px;
      justify-content: center;
      align-items: center;

      border-radius: 6px;
      font-size: 13px;
      font-weight: 500;
      color: var(--r-neutral-body, #d3d8e0);
      background: var(--r-neutral-card1, #fff);
    }

    img.filter-item__chain-logo {
      width: 16px;
      height: 16px;
      border-radius: 1000px;
    }

    .filter-item__chain-close {
      cursor: pointer;
    }
  }
}
.token-selector-disable-item-tips {
  .ant-modal-body {
    background: var(--r-neutral-bg1, #fff);
    padding-top: 24px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-bottom: 20px !important;
  }
  .ant-modal-confirm-content {
    margin-top: 0 !important;
    padding: 0 !important;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: var(--r-neutral-title1, #192945);
  }
  .ant-modal-confirm-btns {
    margin-top: 35px !important;
    .ant-btn {
      font-size: 13px !important;
      font-weight: 500;
    }
    .ant-btn-ghost {
      border-color: var(--r-blue-default);
      color: var(--r-blue-default);
      &:hover {
        background: var(--r-blue-light1, #eef1ff) !important;
      }
    }
  }
}
